<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div class="ps-image">
<!--    <input type="file" id="file" οnchange="onSelectImage()" style="filter:alpha(opacity=0);opacity:0;width:100%;height:100%;"/>-->
    <form id="img_form" action="/login" method="POST">
        <label>
            <input type="text" name="username" id="username" value="test666">
            <input type="text" name="password" id="password" value="123456">
        </label>
        <input type="submit" value="登录">
    </form>
    <span  onclick='upload()'>登录</span>
</div>
</body>
<script src="../jquery/jquery-3.5.1.js"></script>
<script>
    function upload(){
        $.ajax({
            url: '/login',
            type: "POST",
            async:true,
            cache: false,
            data:{
                username:$("#username").val(),
                password:$("#password").val()
            },
            success: function(data) {
                console.log(JSON.stringify(data));
            },
            error: function(data) {
                console.log(data.status);
            }
        });
    }
</script>
</html>